
<%@ page import="coe.pumbaa.Post" %>
<%@ page import="coe.pumbaa.Category" %>
<% def stringManagerService = application.getAttribute("org.codehaus.groovy.grails.APPLICATION_CONTEXT").getBean("stringManagerService") %>
<!doctype html>
<html>
  <head>
    <meta name="layout" content="PumbaaLayout">
  <g:set var="entityName" value="${message(code: 'category.label', default: 'Category')}" />
  <title>Subscription</title>
</head>
<body>
  <section id="main" class="column">
    <pumbaa:alert />
    <article class="module width_full">
        <header><h3>Incoming Event</h3></header>
        <table class="tablesorter" cellspacing="0">
          <thead>
            <tr>
              <th style="width: 20%;">Start</th>
              <th>Event</th>
            </tr>
          </thead>
          <tbody>
          <g:each in="${eventInstanceList}" var="event">
            <tr>
              <td>${event.startTime}</td>
              <td><g:link controller="event" action="show" id="${event.id}">${event.title}</g:link></td>
            </tr>
          </g:each>
          </tbody>
        </table>
        <footer></footer>
      </article>
    <article class="module width_full">
      <header><h3 class="tabs_involved">Content</h3>
        <ul class="tabs">
          <li><a href="#tab1">Last update</a></li>
          <li><a href="#tab2">Subscription</a></li>
        </ul>
      </header>
      <div class="tab_container">
        <div id="tab1" class="tab_content">
          <table class="tablesorter" cellspacing="0">
            <thead>
              <tr>
                <th>Title</th>
                <th>likes</th>
                <th style="width: 200px;">Date</th>
              </tr>
            </thead>
            <tbody>
              <g:each in="${postList}" var="post">
              <tr>
                <td><g:link controller="comment" action="list" id="${post.id}">${stringManagerService.stringToHTML(post.title)}</g:link></td>
              <td>${stringManagerService.countMemberInString(post?.likes)}</td>
              <td><g:formatDate format="dd/MM/yyyy ( HH:mm:ss )" date="${post.timestamp}"/></td>
              </tr>
            </g:each>
            </tbody>
          </table>
        </div>
        <div id="tab2" class="tab_content">
          <table class="tablesorter" cellspacing="0">
            <thead>
              <tr>
                <th>Title</th>
                <th>likes</th>
                <th style="width: 200px;">Date</th>
              </tr>
            </thead>
            <tbody>
            <g:each in="${postSubList}" var="post">
              <tr>
                <td><g:link controller="comment" action="list" id="${post.id}">${stringManagerService.stringToHTML(post.title)}</g:link></td>
              <td>${stringManagerService.countMemberInString(post?.likes)}</td>
              <td><g:formatDate format="dd/MM/yyyy ( HH:mm:ss )" date="${post.timestamp}"/></td>
              </tr>
            </g:each>
            </tbody>
          </table>
        </div>
      </div>
    </article>
    <div class="spacer"></div>
  </section>
</body>
</html>